import React, { Component } from 'react'
import PropTypes from 'prop-types'
import './Checkbox.css'

export default class Checkbox extends Component {
  static propTypes = {
    value: PropTypes.bool.isRequired,
    bindChange: PropTypes.func.isRequired, 
  }
  render() {
    return (
      <div className="Checkbox" onClick={this.select}>
        <div className="checkbox-group" style={{"backgroundColor": this.props.value ? "#67c23a" : "transparent"}}></div>
      </div>
    )
  }
  select = () => {
    if(typeof this.props.bindChange === 'function') this.props.bindChange(!this.props.value)
  }
}
